<template>
	<view class="bottomTab">
		<view @click="jump1">
			<image :src="src1" mode="scaleToFill" style="width: 56rpx; height: 56rpx;"></image>
			<text :class="activesed == '0' ? 'active': ''">{{txt1}}</text>
		</view>
		<view @click="jump2">
			<image :src="src2" mode="scaleToFill" style="width: 41rpx; height: 46rpx;"></image>
			<text :class="activesed == '1' ? 'active': ''">{{txt2}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			actives: {
				type: String,
				default: '0'
			},
			src1: {
				type: String,
				default: "/static/image/clinic/tabbar/tab1.png"
			},
			txt1: {
				type: String,
				default: "消息"
			},
			path1: {
				type: String,
				default: "NaN"
			},
			// 第二个按钮
			src2: {
				type: String,
				default: "/static/image/clinic/tabbar/tab2.png"
			},
			txt2: {
				type: String,
				default: "我的"
			},
			path2: {
				type: String,
				default: "NaN"
			}
		},
		created() {
			if (this.actives == "0") {
				this.activesed = "0";
			} else if (this.actives == "1") {
				this.activesed = "1";
			};
		},
		data() {
			return {
				activesed: null
			};
		},
		methods: {
			jump1() {
				this.activesed = 0;
				if (this.path1 == "NaN") return;
				uni.navigateTo({
					url: this.path1
				});
			},
			jump2() {
				this.activesed = 1;
				if (this.path2 == "NaN") return;
				uni.navigateTo({
					url: this.path2
				});
			}
		}
	}
</script>

<style lang="scss">
	.bottomTab {
		position: fixed;
		width: 750rpx;
		height: 120rpx;
		background-color: #FFFFFF;
		display: flex;
		left: 0;
		bottom: 0;
		justify-content: center;
		align-items: center;

		>view {
			flex: 1;
			height: 100%;
			display: flex;
			flex-wrap: wrap;
			justify-content: center;
			align-items: center;
			box-sizing: border-box;

			image {
				width: 50rpx;
				height: 50rpx;
				transform: translateY(25%);
			}

			.active {
				color: rgba(45, 209, 188, 1) !important;
			}

			>text {
				width: 100%;
				text-align: center;
				color: rgba(186, 186, 186, 1);
			}
		}
	}
</style>
